<div class="panel panel-primary">
    <div class="panel-heading">
        <h3 class="panel-title">
            修改modbusIp
        </h3>
    </div>
    <div class="panel-body">
        <form method="post" id="submitForm2" role="form" class="form-inline">
            <div class="form-group">
                <label for="ip2">IP:</label>
                <input class="form-control"
                       id="ip2" name="ip"
                       value="192.168.4.101" placeholder="192.168.4.101">
            </div>
            <div class="form-group">
                <label for="port2">IP端口:</label>
                <input class="form-control"
                       id="port2" name="port"
                       value="8886" placeholder="8886">
            </div>
            <button type="button" class="btn btn-primary" id="btnSend2">连接测试</button>
            <div class="form-group">
                <label for="ip3">目标ip:</label>
                <input class="form-control"
                       id="ip3" name="ip3"
                       value="" placeholder="192.168.1.101">
            </div>
            <button type="submit" class="btn btn-danger" id="btnSend3">修改</button>
        </form>

    </div>

</div>

<script type="application/javascript">
    $(function () {
        $('#submitForm2').submit(function (e) {
            $.ajax({
                type: "POST",
                dataType: "json",
                url: "/edit",
                data: $('#submitForm2').serialize(),
                success: function (data) {
                    alert(JSON.stringify(data.data))
                },
                error: function (data) {
                    alert(data)
                }
            });
            e.preventDefault();
        });
        $('#btnSend2').click(function (e) {
            $.ajax({
                type: "POST",
                dataType: "json",
                url: "/connect",
                data: $('#submitForm2').serialize(),
                success: function (data) {
                    alert(JSON.stringify(data.data))
                },
                error: function (data) {
                    alert(data)
                }
            });
            e.preventDefault();
        });
    });
</script>